Configuring Connection Failover for the ODBC Client

The ODBC Client can help you make sure that your critical data is available even if the primary database server is unavailable:

Specifying Alternate Servers

To configure connection failover, you specify a list of alternate database servers that are tried at connection time if the primary SequeLink server is not accepting connections. To do this, use the Alternate Servers (AlternateServers) connection option. Connection attempts continue until a connection is successfully established or until all the database servers in the list have been tried once (the default).

On Windows, you can configure a data source to use connection failover on the Failover tab of the driver's Setup dialog box. See "Configuring ODBC Client Data Sources on Windows" for details.

On Linux and UNIX, you can configure a data source to use connection failover by modifying your system information file (odbc.ini). See "odbc.ini File Example" and "odbc64.ini File Example" for details.

On Linux, UNIX, and Windows, you can use a connection string to direct the driver to use connection failover. See "Connection String Example" for details.

Connection String Example

The following connection string configures the ODBC Client connected to a Linux, UNIX, or Windows server to use connection failover in conjunction with all of its optional features-load balancing, connection retry, and connection retry delay.

DSN=MyODBCDSN;AlternateServers=(Host=server1:Port=19996:ServerDataSource=
SDSN1,Host=server2:Port=19996:ServerDataSource=SDSN2,Host=server3:Port=
19996:ServerDataSource=SDSN3);ConnectionRetryCount=4;ConnectionRetryDelay=
5;LoadBalancing=1 

Specifically, if a successful connection is not established on the ODBC Client's first pass through the list of SequeLink servers, this connection string configures the driver to use two alternate servers as connection failover servers, to attempt to connect four additional times if the initial attempt fails, to wait five seconds between attempts, and to try the primary and alternate servers in a random order.

The additional connection information required for the alternate servers is specified in the SequeLink Server data source MyODBCDSN.

odbc.ini File Example

To configure the 32-bit ODBC Client installed on a Solaris machine to use connection failover in conjunction with some of its optional features in your odbc.ini file, you could set the following connection string attributes:

[ODBC Data Sources] 
SALESDB=DataDirect SequeLink 6.0 
[SALESDB] 
Driver=path_of_installdir/lib/ivslk22.so 
Description=DataDirect SequeLink 6.0 
Host= 
Port= 
UseLDAP=0 
DistinguishedName= 
AlternateServers=(Host=server1:Port=19996:ServerDataSource=SDSN1,Host=
server2:Port=19996:ServerDataSource=SDSN2,Host=server3:Port=
19996:ServerDataSource=SDSN3) 
... 
ConnectionRetryCount=4 
ConnectionRetryDelay=5 
... 
LoadBalancing=0 
... 

Specifically, this odbc.ini configuration tells the ODBC Client to use two alternate servers as connection failover servers, to attempt to connect four additional times if the initial attempt fails, to wait five seconds between attempts, and to try the primary and alternate servers in sequential order (do not use load balancing).

odbc64.ini File Example

To configure the 64-bit ODBC Client installed on a Solaris machine to use connection failover in conjunction with some of its optional features in your odbc.ini file, you could set the following connection string attributes:

[ODBC Data Sources] 
AccountingDB=DataDirect SequeLink 6.0 
[AccountingDB] 
Driver=path_of_installdir/lib64/ivslk22.so 
Description=DataDirect SequeLink 6.0 
Host= 
Port= 
UseLDAP=0 
DistinguishedName= 
AlternateServers=(Host=server1:Port=19996:ServerDataSource=SDSN1,Host=
server2:Port=19996:ServerDataSource=SDSN2,Host=server3:Port=
19996:ServerDataSource=SDSN3) 
... 
ConnectionRetryCount=4 
ConnectionRetryDelay=5 
... 
LoadBalancing=1 
... 

This odbc64.ini configuration tells the ODBC Client to use two alternate servers as connection failover servers, to attempt to connect four additional times if the initial attempt fails, to wait five seconds between attempts, and to try the primary and alternate servers in a random order (use load balancing).

Using Connection Retry

Connection retry defines the number of times the Client attempts to connect to the primary server and, if configured, alternate database servers after the initial unsuccessful connection attempt. Connection retry can be an important strategy for system recovery. For example, suppose you have a power failure in which both the client and the server fails. When the power is restored and all computers are restarted, the client may be ready to attempt a connection before the server has completed its startup routines. If connection retry is enabled, the client application can continue to retry the connection until a connection is successfully accepted by the server.

Connection retry can be used in environments that have only one server or can be used as a complementary feature with connection failover in environments with multiple servers.

Using connection options, you can specify the number of times the driver attempts to connect and the time in seconds between connection attempts. For details on configuring connection retry, see "Connecting Using a Connection String".

Using Client Load Balancing

Client load balancing helps distribute new connections in your environment so that no one server is overwhelmed with connection requests. When client load balancing is enabled, the order in which primary and alternate database servers are tried is random.

When Connection Retry is also enabled, the ODBC Client tries to connect to the primary SequeLink server and alternate SequeLink servers in a random order until a successful connection is established. If the connection attempt fails, the driver again randomly selects from the list of servers until all SequeLink servers in the list have been tried or a connection is successfully established.

Connection Failover Attributes

Table 8-1 summarizes the connection attributes that control how connection failover works with the ODBC Client. Refer to the SequeLink Developer's Reference for details about configuring each attribute.

Table 8-1. Summary: Connection Failover Attributes for the ODBC Client 
Attribute
Characteristic
AlternateServers
List of alternate database servers. An IP address or server name and a port number are required for each server. The ServerDataSource connection attribute is optional.
ConnectionRetryCount
Number of times the driver retries the primary database server, and if specified, alternate servers until a successful connection is established. The initial default is 0.
ConnectionRetryDelay
Wait interval, in seconds, between connection retry attempts when the ConnectionRetryCount attribute is set to a positive integer. The initial default is 3.
LoadBalancing
Sets whether the driver will use client load balancing in its attempts to connect to the list of database servers (primary and alternate). If client load balancing is enabled, the driver uses a random pattern instead of a sequential pattern in its attempts to connect. The initial default is 0 (client load balancing is not used).

Refer to the SequeLink Developer's Reference for overviews of connection failover and client load balancing.